package com.zyg.page.controller;

import com.zyg.common.utils.R;
import com.zyg.page.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * ------------------------------
 * 作者: LMY
 * 类-功能: XX
 * 创建时间: 2021-11-17 19:30
 * ------------------------------
 **/
@RestController
@RequestMapping("page")
public class PageController {

    @Autowired
    private PageService pageService;

    @GetMapping("/createHtml/{id}")
    public R createHtml(@PathVariable("id") Long id, HttpServletResponse response) {
        // 根据SKU ID创建静态页面
        pageService.createHtml(id);

        return R.ok().put("文件", "生成文件 " + id + ".html");
    }


}
